package Java网络编程.TCP通信程序练习.p4_客户端数据来自于文本文件;

import java.io.*;
import java.net.Socket;

/*数据来自文本文件*/
public class ClientDemo {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("192.168.189.1",2);

        //封装文本文件的数据
        BufferedReader br = new BufferedReader(new FileReader("idea_test\\client.txt"));
        //封装输出流写数据
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));

        String line;
        while ((line=br.readLine())!=null){
            bw.write(line);
            bw.newLine();
            bw.flush();
        }

        br.close();
        s.close();
    }
}
